spl: mmc: refactor device location code to its own function
authorNikita Kiryanov <[email protected]>
Sun, 8 Nov 2015 15:11:44 +0000 (17:11 +0200)
committerTom Rini <[email protected]>
Wed, 18 Nov 2015 19:50:00 +0000 (14:50 -0500)
commit4188ba3202172863d6034adfcac805e8bccf186a
tree0df52ad83243d28cd089069dae59eea096ca0400
parentfd61d39970b9901217efc7536d9f3a61b4e1752a
spl: mmc: refactor device location code to its own function

Simplify spl_mmc_load_image() code by moving the part that finds the mmc device
into its own function spl_mmc_find_device(), available in two flavors: DM and
non-DM.

This refactor fixes a bug in which an error in the device location sequence
does not necessarily aborts the rest of the code. With this refactor, we fail
the moment there is an error.

Signed-off-by: Nikita Kiryanov <[email protected]>
Cc: Igor Grinberg <[email protected]>
Cc: Paul Kocialkowski <[email protected]>
Cc: Pantelis Antoniou <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Simon Glass <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
Reviewed-by: Tom Rini <[email protected]>
common/spl/spl_mmc.c